<?php


class Shangpin
{
    public $name;
    public $jiage;
    public $kucun;

    public function __construct($name,$jiage)
    {
        $this->name = $name;
        $this->jiage =$jiage;
    }
//    public function __get($name)
//    {
//
//    }

    function sp(){
        echo "商品名称为".$this->name."，售价为".$this->jiage."元，目前库存还有".$this->kucun."件";
    }

//    public function __destruct()
//    {
//
//    }
}

class  Shouji extends Shangpin{
    public $pingpai;
    public $chandi;

    public function __construct($name, $jiage)
    {
        parent::__construct($name, $jiage);
    }

    function sj(){
        echo "商品名称为".$this->name."，售价为".$this->jiage."元，目前库存还有".$this->kucun."件，品牌是".$this->pingpai."，产地是".$this->chandi;
    }
}